package com.smh.a01IOStreamDemo1;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class IOStreamDemo8 {
    public static void main(String[] args) {
//        try catch finally
        FileInputStream fis = null;
        FileOutputStream fos = null;

        try {
            fis = new FileInputStream("day26-code\\file\\a.txt");
            fos = new FileOutputStream("day26-code\\file\\b.txt");

            byte[] bytes = new byte[1024 * 1024];
            int len;

            while ((len = fis.read(bytes)) > 0) {
                fos.write(bytes, 0, len);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                if (fos != null) {
                    fos.close();
                }
                if (fis != null) {
                    fis.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }


    }
}
